<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>v-bind</title>
  <script src="../assets/js/vue.js"></script>
</head>
<body>
  <h1>v-bind</h1>
  <hr>
  <div id="app">
    <img v-bind:src="src" width="200" />
    <br>
    <a :href="webUrl" target="_blank">jiPang</a>
    <div :class="className">
      <h3>绑定class</h3>
    </div>
    <div :class="{classA: isOk}">
        <h3>绑定class判断</h3>
    </div>
    <div :class="[classA, classB]">
        <h3>绑定class数组</h3>
    </div>
    <div :class="isOk ? classA : classB">
        <h3>绑定class三元运算判断</h3>
    </div>
    <hr>
    <div>
      <input type="checkbox" id="isOk" v-model="isOk">
      <label for="isOk">isOk: {{ isOk }}</label>
    </div>
    <hr>
    <div :style="{color: color, fontSize: font}">
        <h3>绑定style，和reacr很像，直接传进去就可以</h3>
      </div>
    <div :style="styleObj">
      <h3>绑定style对象， 和reacr很像，直接传进去就可以</h3>
    </div>
  </div>
  <style>
    .classA {
      color: red;
    }
    .classB {
      font-size: 150%;
    }
  </style>
  <script>
    var app = new Vue({
      el: '#app',
      data: {
        src: "https://user-gold-cdn.xitu.io/2018/6/22/164263a2e472715a?imageView2/0/w/1280/h/960/format/webp/ignore-error/1",
        webUrl: 'http://jspang.com/2017/02/23/vue2_01/',
        className: 'classA',
        isOk: true,
        classA: 'classA',
        classB:'classB',
        color: 'gray',
        font: '30px',
        styleObj: {
          color: 'green',
          fontSize: '12px'
        }
      }
    })
  </script>
</body>
</html>